#!/bin/bash 
basedir=`cd $(dirname $0); pwd -P`
echo $basedir
echo ""
echo ""
echo ""
echo ""
echo "         ==================================================="
echo "         |    欢迎安装并使用FPVcast数字图传数传系统！         |"
echo "         |                                                 |"
echo "         |         它兼容4G/5G WIFI等通讯方式                |"
echo "         |                                                 |"
echo "         |         update by Violet_2046 2024.5.27         |"
echo "         ==================================================="
echo ""
sleep 5
echo ""
echo ""
echo ""
echo "" 
echo ""
echo ""
echo "        ==================================================="
echo "        |                 1.更新树莓派国内源              |"
echo "        ==================================================="
echo "                      "
sudo sed -i 's#://raspbian.raspberrypi.org#s://mirrors.tuna.tsinghua.edu.cn/raspbian#g' /etc/apt/sources.list
sudo sed -i 's#://archive.raspberrypi.org/debian#s://mirrors.tuna.tsinghua.edu.cn/raspberrypi#g' /etc/apt/sources.list.d/raspi.list
echo " "
echo "        ==================================================="
echo "        |                  2.升级安装源包                 |"
echo "        ==================================================="
echo "                          "
echo ""
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get -f isntall
echo ""
echo "        ==================================================="
echo "        |                  3.安装git                      |"
echo "        ==================================================="
echo "                             "
echo ""
sudo apt-get install git -y
echo ""
echo "        ==================================================="
echo "        |                  4.获取软件包                   |"
echo "        ==================================================="
echo "                           "
rm -rf fpvcast_2046/
git clone https://gitee.com/Violet_2046/fpvcast_2046.git
chmod -R 777 fpvcast_2046/
cd fpvcast_2046/install/
echo ""
echo "        ==================================================="
echo "        |                  5.开始安装FPVcast系统          |"
echo "        ==================================================="
echo "            "
 ./install.sh web
echo ""
echo "        ==================================================="
echo "        |                 6.即将安装完成，清理临时文件     |"
echo "        ==================================================="
printf "\n\n\n安装完毕。 \n 重启树莓派登录树莓派IP \n 即可后台管理树莓派4G/5G图传了。\n"
